using System;
using Sinacor.Infra.Common;
using System.Collections.Generic;
using Sinacor.Service.Infra.AuthorizationService.Service.DataContract.Request;
using Sinacor.Service.Infra.AuthorizationService.BusinessEntity;

namespace Sinacor.Service.Infra.AuthorizationService.Service.ServiceImplementation.Translator
{
    /// <summary>
    /// Classe tradutora entre objetos UpdatePolicyRequest e Policy
    /// </summary>
    public class RetrievePoliciesRequestToPolicy : 
        BaseTranslator<BusinessEntity.Policy, DataContract.Request.RetrievePoliciesRequest, 
        List<BusinessEntity.Policy>, List<DataContract.Request.RetrievePoliciesRequest>>
    {
        public override BusinessEntity.Policy Translate(DataContract.Request.RetrievePoliciesRequest from)
        {
            if (from == null)
                return null;

            BusinessEntity.Policy to = new BusinessEntity.Policy();
            to.PolicyId = from.PolicyId;
            to.PolicyName = from.PolicyName;

            BusinessEntity.Enum.PolicyStatus? status;
            PolicyStatusTranslator statusTranslator = new PolicyStatusTranslator();
            statusTranslator.Translate(from.PolicyStatus, out status);
            to.PolicyStatus = status;

            BusinessEntity.Enum.PolicyType? policyType;
            PolicyTypeTranslator policyTypeTranslator = new PolicyTypeTranslator();
            policyTypeTranslator.Translate(from.PolicyType, out policyType);
            to.PolicyType = policyType;

            return to;
        }



    }
}

